package com.app.biz.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import com.app.biz.domain.BizIndustrialEconomy;
import com.app.biz.service.IBizIndustrialEconomyService;
import com.app.common.annotation.Log;
import com.app.common.core.controller.BaseController;
import com.app.common.core.domain.AjaxResult;
import com.app.common.core.page.TableDataInfo;
import com.app.common.enums.BusinessType;
import com.app.common.utils.poi.ExcelUtil;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


/**
 * 工业经济运行分析Controller
 * 
 * @author ruoyi
 * @date 2024-09-09
 */
@RestController
@RequestMapping("/system/economy")
public class BizIndustrialEconomyController extends BaseController
{
    @Autowired
    private IBizIndustrialEconomyService bizIndustrialEconomyService;

    /**
     * 查询工业经济运行分析列表
     */
    @PreAuthorize("@ss.hasPermi('system:economy:list')")
    @GetMapping("/list")
    public TableDataInfo list(BizIndustrialEconomy bizIndustrialEconomy)
    {
        startPage();
        List<BizIndustrialEconomy> list = bizIndustrialEconomyService.selectBizIndustrialEconomyList(bizIndustrialEconomy);
        return getDataTable(list);
    }

    /**
     * 导出工业经济运行分析列表
     */
    @PreAuthorize("@ss.hasPermi('system:economy:export')")
    @Log(title = "工业经济运行分析", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, BizIndustrialEconomy bizIndustrialEconomy)
    {
        List<BizIndustrialEconomy> list = bizIndustrialEconomyService.selectBizIndustrialEconomyList(bizIndustrialEconomy);
        ExcelUtil<BizIndustrialEconomy> util = new ExcelUtil<BizIndustrialEconomy>(BizIndustrialEconomy.class);
        util.exportExcel(response, list, "工业经济运行分析数据");
    }

    /**
     * 获取工业经济运行分析详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:economy:query')")
    @GetMapping(value = "/{baseId}")
    public AjaxResult getInfo(@PathVariable("baseId") String baseId)
    {
        return success(bizIndustrialEconomyService.selectBizIndustrialEconomyByBaseId(baseId));
    }

    /**
     * 新增工业经济运行分析
     */
    @PreAuthorize("@ss.hasPermi('system:economy:add')")
    @Log(title = "工业经济运行分析", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody BizIndustrialEconomy bizIndustrialEconomy)
    {
        return toAjax(bizIndustrialEconomyService.insertBizIndustrialEconomy(bizIndustrialEconomy));
    }

    /**
     * 修改工业经济运行分析
     */
    @PreAuthorize("@ss.hasPermi('system:economy:edit')")
    @Log(title = "工业经济运行分析", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody BizIndustrialEconomy bizIndustrialEconomy)
    {
        return toAjax(bizIndustrialEconomyService.updateBizIndustrialEconomy(bizIndustrialEconomy));
    }

    /**
     * 删除工业经济运行分析
     */
    @PreAuthorize("@ss.hasPermi('system:economy:remove')")
    @Log(title = "工业经济运行分析", businessType = BusinessType.DELETE)
	@DeleteMapping("/{baseIds}")
    public AjaxResult remove(@PathVariable String[] baseIds)
    {
        return toAjax(bizIndustrialEconomyService.deleteBizIndustrialEconomyByBaseIds(baseIds));
    }
}
